<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  const createObj = (function(){
    // 公共功能
    function fn(){
      console.log("hello 我叫：" + this.name);
    }
    function call(){
      console.log(this.name + "在打电话");
    }
    // 构造函数
    return function(n, a, s){
      const obj = {};
      obj.name = n;
      obj.sayHello = fn;
      obj.call = call;
      return obj;
    }
  })();

  const o1 = createObj("李四", 20, "女");
  console.log(o1)
  o1.sayHello()
  o1.call();
  
  const o2 = createObj("张三", 18, "男");
  console.log(o2)
  o2.sayHello()
  o2.call()

  console.log( o1.sayHello === o2.sayHello );
  console.log( o1.call === o2.call );

  // =========

  const arr1 = new Array(4,5,6);
  const arr2 = new Array(4,5,6);

  console.log(arr1);
  console.log(arr2);
  console.log(arr1 === arr2);
  
  arr1.push("hello");
  arr2.push("hello");

  console.log(arr1);
  console.log(arr2);

  console.log(arr1.push === arr2.push);

  const str = "hello";
  console.log(str.indexOf === arr1.indexOf);

  
  console.log(arr1.indexOf === arr2.indexOf);

  console.log(arr1 === arr2);

</script>
</html>